home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
C/C++ Users Group Library 1996 July
/
C-C++ Users Group Library July 1996.iso
/
listings
/
v_13_05
/
colton
/
flipy.c
< prev
next >
Wrap
C/C++ Source or Header
|
1995-02-21
|
778b
|
52 lines
/*
* Listing 9 - flipy.c
*/
#include <stdio.h>
#include "ips_image.h"
void flipy();
int
main(argc, argv)
int argc;
char **argv;
{
ips_header header;
ips_image image, newimage;
if (argc<3) {
printf("Usage: %s infile outfile", argv[0]);
exit(1);
}
ips_to_img(&header, &image, argv[1]);
flipy(&header, &image, &newimage);
img_to_ips(&header, &newimage, argv[2]);
exit(0);
}
void
flipy(header, image, newimage)
ips_header *header;
ips_image *image, *newimage;
{
long cnt;
memcpy(newimage->cmap, image->cmap, sizeof(XColor) * 256);
newimage->data =
(unsigned char *)malloc(header->width *
header->height);
for(cnt=0;cnt < header->width * header->height;cnt++)
newimage->data[cnt] =
image->data[(header->width * header->height) -
cnt];
}